<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('修改词组详情')" />
    <th:block th:include="include :: summernote-css" />
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-cizunew-edit" th:object="${cizu}">
            <input name="id" th:field="*{id}" type="hidden">
            <div class="form-group">    
                <label class="col-sm-2 control-label">词组：</label>
                <div class="col-sm-10">
                    <input name="ci" th:field="*{ci}" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-2 control-label">拼音：</label>
                <div class="col-sm-10">
                    <input name="py" th:field="*{py}" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-2 control-label">拼音：</label>
                <div class="col-sm-10">
                    <input name="pinyin" th:field="*{pinyin}" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-2 control-label">同义词：</label>
                <div class="col-sm-10">
                    <input name="tongyici" th:field="*{tongyici}" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-2 control-label">反义词：</label>
                <div class="col-sm-10">
                    <input name="fanyici" th:field="*{fanyici}" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-2 control-label">快快查字典：</label>
                <div class="col-sm-10">
                    <input id="yzjsAi" name="yzjsAi" th:field="*{yzjsAi}" type="hidden">
                    <div id="editor-yzjsAi" class="summernote"></div>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-2 control-label">汉语词典：</label>
                <div class="col-sm-10">
                    <input id="hycd" name="hycd" th:field="*{hycd}" type="hidden">
                    <div id="editor-hycd" class="summernote"></div>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-2 control-label">词语解释：</label>
                <div class="col-sm-10">
                    <input id="cyjs" name="cyjs" th:field="*{cyjs}" type="hidden">
                    <div id="editor-cyjs" class="summernote"></div>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-2 control-label">成语解释：</label>
                <div class="col-sm-10">
                    <input id="chenyujs" name="chenyujs" th:field="*{chenyujs}" type="hidden">
                    <div id="editor-chenyujs" class="summernote"></div>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-2 control-label">引证解释：</label>
                <div class="col-sm-10">
                    <input id="yzjs" name="yzjs" th:field="*{yzjs}" type="hidden">
                    <div id="editor-yzjs" class="summernote"></div>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-2 control-label">国语词典：</label>
                <div class="col-sm-10">
                    <input id="gycd" name="gycd" th:field="*{gycd}" type="hidden">
                    <div id="editor-gycd" class="summernote"></div>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-2 control-label">词语解释(汉典)：</label>
                <div class="col-sm-10">
                    <input id="cyjsHd" name="cyjsHd" th:field="*{cyjsHd}" type="hidden">
                    <div id="editor-cyjsHd" class="summernote"></div>
                </div>
            </div>
        </form>
    </div>
    <th:block th:include="include :: footer" />
    <th:block th:include="include :: summernote-js" />
    <script src="/js/standalone.js"></script>
    <script src="/js/parser-html.js"></script>
    <script type="text/javascript">
        var prefix = ctx + "dict/cizunew";
        $("#form-cizunew-edit").validate({
            focusCleanup: true
        });

        function prettierFormat(html) {
            try{
                if(prettier == null || prettierPlugins == null) {
                  return html;
                }
                return prettier.format(html, {
                  parser: "html",
                  plugins: prettierPlugins
                });
            }catch(error){
               return html;
            }
        }

        $(function() {
		    $('.summernote').summernote({
		    	placeholder: '请输入内容',
		    	height : 400,
				lang : 'zh-CN',
				followingToolbar: false,
				callbacks: {
	                onImageUpload: function (files) {

	                }
	            }
		    });
		    $('#editor-hycd').summernote('code', prettierFormat($("#hycd").val()));
		    $('#editor-chenyujs').summernote('code', prettierFormat($("#chenyujs").val()));
		    $('#editor-cyjs').summernote('code', prettierFormat($("#cyjs").val()));
		    $('#editor-yzjs').summernote('code', prettierFormat($("#yzjs").val()));
		    $('#editor-yzjsAi').summernote('code', prettierFormat($("#yzjsAi").val()));
		    $('#editor-gycd').summernote('code', prettierFormat($("#gycd").val()));
		    $('#editor-cyjsHd').summernote('code', prettierFormat($("#cyjsHd").val()));
	    });

        function submitHandler() {
            if ($.validate.form()) {
                $('#hycd').val($('#editor-hycd').summernote('code'));
                $('#chenyujs').val($('#editor-chenyujs').summernote('code'));
                $('#cyjs').val($('#editor-cyjs').summernote('code'));
                $('#yzjs').val($('#editor-yzjs').summernote('code'));
                $('#yzjsAi').val($('#editor-yzjsAi').summernote('code'));
                $('#gycd').val($('#editor-gycd').summernote('code'));
                $('#cyjsHd').val($('#editor-cyjsHd').summernote('code'));
                $.operate.save(prefix + "/edit", $('#form-cizunew-edit').serialize());
            }
        }
    </script>
</body>
</html>